<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

/**
 * 微信素材主表
 */
class CreateWxMaterial extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('wx_materials', function (Blueprint $table) {
            $table->increments('material_id')->comment('素材序号');
            $table->unsignedInteger('cat_id')->default(0)->comment('素材所属分组');
            $table->string('type', 20)->default('')->comment('素菜类别');
            $table->string('media_id', 150)->default('')->comment('素材ID');
            $table->unsignedTinyInteger('is_forever')->default(0)->comment('是否为永久素材(0:临时,1:永久)');
            $table->timestamp('expire_time')->nullable()->comment('过期时间');
            $table->mediumText('preview_data')->nullable()->comment('预览数据');
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('wx_materials');
    }
}
